
import SwiftUI
import GRDB

struct DuetAttachmentsView: View {
    let rows: [Row]
    @State var urls = [String]()
    @State var texts = [String]()

    var body: some View {
        List {
            ForEach(urls) { text in
                Text(text)
            }
            ForEach(texts) { text in
                Text(text)
            }
        }.onAppear(perform: {
            rows.forEach({ row in
                if let text: String = row["ZCONTENTTEXT"] {
                    texts.append(text)
                }
                if let url: String = row["ZCONTENTURL"] {
                    urls.append(url)
                }
            })
        })
    }
}

extension String: Identifiable {
    public var id: String {
        self
    }
}

//struct DuetAttachmentsView_Previews: PreviewProvider {
//    static var previews: some View {
//        DuetAttachmentsView()
//    }
//}
